import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import commonjs from 'vite-plugin-commonjs';

export default defineConfig({
  build: {
    lib: {
      entry: 'src/index.ts',
      name: 'web-multidevice-advanced-ui',
      fileName: 'index',
    },
    rollupOptions: {
      external: [],
      output: [
        {
          format: 'es',
          entryFileNames: '[name].es.js',
          chunkFileNames: '[name]-[hash].es.js',
        },
        {
          format: 'cjs',
          entryFileNames: '[name].cjs.js',
          chunkFileNames: '[name]-[hash].cjs.js',
        },
      ]
    }
  },
  plugins: [
    dts({
      insertTypesEntry: true,
    }),
    commonjs(),
  ]
});